import { ComponentOutput } from './component-output.entity'
import { ComponentInput } from './component-input.entity'
import { Entity, PrimaryGeneratedColumn, OneToMany, Column } from 'typeorm'

@Entity({
  engine: 'InnoDB'
})
export class Component {
  @PrimaryGeneratedColumn()
  id: number

  @Column({
    comment: '选择器',
    unique: true
  })
  selector: string

  @Column({
    charset: 'utf8'
  })
  title: string

  @Column({
    charset: 'utf8'
  })
  description: string

  @OneToMany(type => ComponentInput, input => input.component)
  inputs: ComponentInput[]

  @OneToMany(type => ComponentOutput, output => output.component)
  outputs: ComponentOutput[]
}
